﻿Imports System.Runtime.CompilerServices

Module ExtensionModule

    <Extension()> _
    Public Function WithoutSymbols(ByVal text As String) As String

        Dim builder = New System.Text.StringBuilder
        For Each c In text

            'If Not deleteChars.Contains(c) Then
            '    builder.Append(c)
            'End If
            If Char.IsLetterOrDigit(c) Then
                builder.Append(c)
            ElseIf Char.IsWhiteSpace(c) Then
                builder.Append(" ")
            End If

        Next
        Return builder.ToString

    End Function


    <Extension()> _
    Public Function NormalizeAlphanumeric(ByVal text As String) As String

        Const oldChars As String = "ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ０１２３４５６７８９"
        Const newChars As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"

        Dim builder = New System.Text.StringBuilder
        For Each c In text
            Dim index = oldChars.IndexOf(c)
            If index >= 0 Then
                builder.Append(newChars(index))
            Else
                builder.Append(c)
            End If
        Next
        Return builder.ToString.ToUpper

    End Function




End Module
